<%-- 
    Document   : Answer the Question Page
    Created on : 11/08/2011, 12:32:04 PM
    Author     : Lan Ye 42239015
    User Type  : Web User
    Description: This page contains the question which is open for Web use.
                 User will answer/edit the questions and give the feedback to poll master.
--%>


<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../header.jsp" %>

<div id="content-container">
    <div id="content">

        <%if (request.getParameter("pollID") != null) {%>
        <c:choose>
            <c:when test = "${!closed}">
                <div id="tablecontainer">
                    <form  method="post">
                    <form:form name="question" id="question" commandName="question" METHOD="POST">
                        <p>Question:<c:out value="${question.getText()}"/></br></p>
                        <p>${question.displayQuestion(1)}</p></br>
                        <button align ="center" type="reset" value="Reset">Reset</button>
                        <input align ="center" type="button" value="Privious Question" onclick="window.location='answer.html?pollID=${question.getPollId()}&questionID=${next-1}'" />
                        <input align ="center" type="button" value="Next Question" onclick="window.location='answer.html?pollID=${question.getPollId()}&questionID=${next}'" />
                        <input align ="center" type="button" value="View Result" onclick="window.location='/DbPoll/viewResults.html?pid=${question.getPollId()}&qid=${question.getId()}'"/>
                        <input align ="center" type="button" value="Feedback" onclick="window.location='feedback.html'"></>
                        
                    </form:form>
                </div>
            </c:when>
            <c:otherwise>
                <p> There are no more open question</p>
                <p><input align ="center" type="button" value="Go back to home page" onclick="window.location='home.html'" /><br>
                </p></br>
            </c:otherwise>
        </c:choose>
        <% } else
                out.println("<p>There is an error on the page</p>");
        %>

    </div>
</div>		

<%@ include file="../footer.jsp" %>
